package com.whjh.image.conpression.task;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@ConditionalOnExpression("#{@environment.getProperty('image.conpression.enableForkJoin') == 'true' && @environment.getProperty('image.conpression.enableType') == 'fixedDelay'}")
@Component
public class DelayTaskForkJoin extends ImageCompressionTaskForkJoin {
	private static Logger logger = LoggerFactory.getLogger(DelayTaskForkJoin.class);

	// 任务执行后1分钟再执行
	@Scheduled(fixedDelayString = "${image.conpression.fixedDelay}")
	public void execute() throws InterruptedException, IOException {
		logger.info("DelayTaskForkJoin");
		doExecute();
	}
}
